import { ref, reactive, computed } from 'vue'  
import { defineStore } from 'pinia'  
  
export const useSystemStore = defineStore('system', () => {  
    
  const collapse = ref(false)   // 导航栏收缩状态  
  
  const userInfo = ref({})      // 登录的用户信息  
     
  
  // 初始化用户信息  
  const initUserInfo = (userInfoParam) => {  
    userInfo.value = userInfoParam  
  }  
  
  // 改变收缩状态  
  const toggleCollapse = () => {  
    collapse.value = !collapse.value;  
  }  
  
  // 退出登录  
  const logout = () => {  
    userInfo.value = {};  
  }  
    
  return { collapse, userInfo, initUserInfo, toggleCollapse, logout }  
})